package com.management.department.teacherinfosystem.Repository;

import com.management.department.teacherinfosystem.Entity.ResearchProjectMember;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface ResearchProjectMemberRepository extends JpaRepository<ResearchProjectMember, Long> {
    
    // 根据项目ID查询成员
    List<ResearchProjectMember> findByProjectId(@Param("projectId") Long projectId);
    
    // 根据用户ID查询参与的项目
    List<ResearchProjectMember> findByUserId(@Param("userId") Long userId);
    
    // 根据项目ID删除成员
    void deleteByProjectId(@Param("projectId") Long projectId);
    
    // 根据工号查询成员
    List<ResearchProjectMember> findByStaffNo(@Param("staffNo") String staffNo);
    
    // 根据部门查询成员
    List<ResearchProjectMember> findByDepartment(@Param("department") String department);
}
